Skip to content

feat: implement bank account system with audit logging to BankATM#526

Closed
Dlafferty251 wants to merge 10 commits intocode-differently:mainfrom
Dlafferty251:Homework17-ATM
Closed

feat: implement bank account system with audit logging to BankATM#526
Dlafferty251 wants to merge 10 commits intocode-differently:mainfrom
Dlafferty251:Homework17-ATM

Conversation

@Dlafferty251
Copy link
Copy Markdown
Contributor

I have started the assignment, yet have not completed it. I have a savings account made that will override the withdraw method to not allow withdrawls if the user is on the savings account. I need to implement a feature that checks which account the user is on. I also have plans to add an Audit log feature because I think it will be a good way to teach me SOLID principles.

@Dlafferty251 Dlafferty251 changed the title feat: implement bank account system with audit logging and adds a sav… feat: implement bank account system with audit logging to BankATM Apr 14, 2025
Copy link
Copy Markdown
Contributor

@anthonydmays anthonydmays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is WIP, so keep going.


import java.util.ArrayList;

public class AuditLog {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bad implementation, good work. You might be interested in a library called Log4j that could be useful to you as well, but this is good enough for your homework.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored AuditLog class to Implement Log4j logic instead of custom implementation.


private final Map<UUID, Customer> customerById = new HashMap<>();
private final Map<String, CheckingAccount> accountByNumber = new HashMap<>();
private final AuditLog auditLog = new AuditLog();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates the D in SOLID, no?

* The {@code SavingsAccount} class represents a savings account in a banking system. It extends the
* {@code CheckingAccount} class and provides additional functionality specific to savings accounts.
*/
public class SavingsAccount extends CheckingAccount {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A savings accounts is not a checking account.

if (isClosed()) {
throw new IllegalStateException("Cannot withdraw from a closed account");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@Dlafferty251 Dlafferty251 deleted the Homework17-ATM branch April 25, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants